<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>url的编码与解码</title>
</head>

<body>
    <!-- 编码函数: encodeURI(str) -->
    <!-- 解码函数: decodeURI(编码后的安全字符) -->
    <script>
        var str = '陈嘉兴'
       console.log( encodeURI(str));//%E9%99%88%E5%98%89%E5%85%B4 //三个百分号对应一个中文字符
     console.log(decodeURI('%E9%99%88'));//陈
      
    </script>
</body>

</html>